// 公共样式
%common {
  width: 100px;
  height: 100px;
}
body {
  background-color: skyblue;
}
// 正方形
.box {
  background-color: lightgoldenrodyellow;
  @extend %common;
  margin: 0 auto;
  margin-top: 100px;
  transform: rotate(45deg);
  position: relative;
  animation: heart 1s ease-in-out 0s infinite alternate;
  // 圆形
  &::before {
    content: "";
    @extend %common;
    border-radius: 50%;
    background-color: lightgoldenrodyellow;
    position: absolute;
    left: -50px;
    top: 0;
    animation: yuan 1s ease-in-out 0s infinite alternate;
  }
  // 圆形
  &::after {
    content: "";
    @extend %common;
    border-radius: 50%;
    background-color: lightgoldenrodyellow;
    position: absolute;
    left: 0px;
    top: -50px;
    animation: yuan 1s ease-in-out 0s infinite alternate;
  }
}

@keyframes heart {
  form {
    transform: rotate(45deg) translate(0px, 0px) scale(1);
  }

  50% {
    transform: rotate(45deg) translate(50px, 50px) scale(2);
    top: 0px;
    background-color: pink;
  }

  to {
    transform: rotate(45deg) translate(0px, 0px) scale(1);
    top: 300px;
  }
}
@keyframes yuan {
  50% {
    background-color: pink;
  }
  to {
    background-color: lightgoldenrodyellow;
  }
}
